#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
    char str[256] = {0};
    int a[256] = { 0 };//n*(n+1)/2>256
    scanf("%s", str);
    int i = 0;
    int cur = 0;
    int length = 1;
    for (i = 1; i < 256; ++i)
    {
        if (str[i] - str[i - 1] == 1)
        {
            length++;
        }
        else
        {
            a[length] = cur;
            length = 1;
            cur = i;
        }
    }
    length = 255;
    int max = 0;
    while (a[length] == 0)
    {
        length--;
    }
    char j = a[length];
    while (length--)
    {
        printf("%c", str[j]);
        j++;
    }
    


    return 0;
}